﻿<link href="@Url.Content("~/Content/css/codeviewer.css")" rel="stylesheet" type="text/css" />
<script type="text/javascript">
    $(function () {
        var action = "@Url.Action("CodeView", new { codeViewType = ViewBag.CodeViewType })";
        var $codePane = $("div.code").data("loaded", false);
        var loadCode = function(){
            $codePane.load(action, function(){
                $codePane.data("loaded", true);
                toggleCode();
            });
        };
        var toggleCode = function(){ $codePane.is(":visible") ? $codePane.hide() : $codePane.show(); };             
        $("#codeView a:first").click(function () {
            if(!$codePane.data("loaded")) { loadCode(); return;}
            toggleCode();            
        });
    });
</script>

<div id="codeView" class="clearfix">
    <h4><a href="#">View Code</a></h4>
    <div class="code"></div>
</div>